package com.idpd.develop.dept.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.idpd.develop.dept.mapper.DeptMapper;
import com.idpd.develop.dept.pojo.Dept;

@Service
public class DeptService {
	
	@Autowired
	DeptMapper deptMapper;  
	
	public List<Dept> showAll(int page,int limit,String deptno){
		int begin = (page - 1) * limit;
		deptno = ("".equals(deptno) ? null : deptno);
		return deptMapper.showall(begin,limit,deptno);
	}
	
	public int getcount(String deptno){
		deptno = ("".equals(deptno) ? null : deptno);
		return deptMapper.getCount(deptno);
	}
	
	public int delete(int deptno) {
		return deptMapper.deleteDeptno(deptno);
	}

	public int update(Dept dept) {
		return deptMapper.update(dept);
	}

	public int insert(Dept dept) {
		return deptMapper.insert(dept);
	}
	
}
